import axios from "~/axios";
import { queryFilters } from "~/composables/util";

// 获取公司列表
export function getCompanyList({ ...data }) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    
    return axios.get(`/company/list/${r}`)
}

// 获取全部公司列表
export function getALLCompanyList() {
    return axios.get(`/company/list/all/`)
}


// 新增公司
export function postCompany(data) {
    return axios.post(`/company/list/`, data)
}

// 修改公司
export function putCompany(id, data) {
    return axios.put(`/company/list/${id}/`, data)
}
// 删除公司
export function deleteCompany(id) {
    return axios.delete(`/company/list/${id}/`)
}


// 设置用户信息
export function setCompanyAuth(data) {
    return axios.put(`/company/list/set_company_auth/`,data)
}


// 获取部门列表
export function getDepartmentList({ ...data }) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    
    return axios.get(`/company/department/${r}`)
}

// 获取全部部门列表
export function getALLDepartmentList(){
    return axios.get(`/company/department/all/`)
}


// 新增公司
export function postDepartment(data) {
    return axios.post(`/company/department/`, data)
}

// 修改公司
export function putDepartment(id, data) {
    return axios.put(`/company/department/${id}/`, data)
}
// 删除公司
export function deleteDepartment(id) {
    return axios.delete(`/company/department/${id}/`)
}




// 获取公司列表
export function getEmployeeList({ ...data }) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    
    return axios.get(`/user/employeeList/${r}`)
}


// 新
export function postEmployeeList(data) {
    return axios.post(`/user/employeeList/`, data)
}

// 修改公司
export function putEmployeeList(data) {
    return axios.post(`/user/employeeList/set_employee/`, data)
}
// 删除公司
export function deleteEmployeeList(id) {
    return axios.delete(`/user/employeeList/${id}/`)
}


